"""
    ================================================================================
                            ------------utf-8--------------
    ================================================================================
@Author: 
    rfdsg
@Create Time: 
    2025/3/6 - 21:20
@Description:

@Attention:
    
"""
import psutil
import torch


def print_mem_usage():
    allocated = torch.cuda.memory_allocated() / 1024 ** 3
    cached = torch.cuda.memory_reserved() / 1024 ** 3
    print(f"已分配: {allocated:.2f} GB, 缓存: {cached:.2f} GB")


def print_memory_usage():
    process = psutil.Process()
    mem = process.memory_info().rss / 1024 ** 3  # 单位GB
    print(f"当前内存占用: {mem:.2f} GB")
